﻿<UserControl x:Class="TeamProjectManager.Modules.WorkItemConfiguration.WorkItemQueriesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="clr-namespace:TeamProjectManager.Common.Infrastructure;assembly=TeamProjectManager.Common"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <TextBlock Text="This functionality is not supported in the version of the currently selected Team Project Collection: TFS 2010 or higher is required." TextWrapping="Wrap" TextAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding Path=TfsUnsupportedVisibility}" />

        <TabControl Visibility="{Binding Path=TfsSupportedVisibility}">

            <TabItem Header="View / Export / Delete / Edit" i:HelpProvider.HelpContent="Allows you to get an overview of the work item queries across multiple Team Projects. You can also export their definitions to WIQ files, edit them in-place, and delete them from Team Projects.">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Button Grid.Row="0" Content="Get Work Item Queries" Margin="0,5,0,5" Command="{Binding Path=GetWorkItemQueriesCommand}" />
                    <DataGrid Grid.Row="1" ItemsSource="{Binding Path=WorkItemQueries}" IsReadOnly="True" AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto" x:Name="workItemQueriesDataGrid" SelectionChanged="workItemQueriesDataGrid_SelectionChanged">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Team Project" Binding="{Binding Path=TeamProject}" />
                            <DataGridTextColumn Header="Type" Binding="{Binding Path=Type}" />
                            <DataGridTextColumn Header="Path" Binding="{Binding Path=Path}" />
                            <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
                        </DataGrid.Columns>
                    </DataGrid>
                    <WrapPanel Grid.Row="2" Margin="0,5,0,0">
                        <Button Content="Export" Command="{Binding Path=ExportSelectedWorkItemQueriesCommand}" />
                        <Button Content="Delete" Margin="5,0,0,0" Command="{Binding Path=DeleteSelectedWorkItemQueriesCommand}" />
                        <Button Content="Edit..." Margin="5,0,0,0" Command="{Binding Path=EditSelectedWorkItemQueriesCommand}" />
                    </WrapPanel>
                </Grid>
            </TabItem>

            <TabItem Header="Import" i:HelpProvider.HelpContent="Allows you to import work item queries in existing Team Projects. This can be useful if you want to standardize work item queries across Team Projects.">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Button Grid.Row="0" Content="Scan Folder Hierarchy..." ToolTip="Imports work item queries from a folder while preserving the folder hierarchy" Margin="0,5,0,5" Command="{Binding Path=ScanForWorkItemQueriesToImportCommand}" />
                    <DataGrid Grid.Row="1" ItemsSource="{Binding Path=WorkItemQueriesToImport}" IsReadOnly="True" AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Path" Binding="{Binding Path=Path}" />
                            <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
                        </DataGrid.Columns>
                    </DataGrid>
                    <WrapPanel Grid.Row="2" Margin="0,5,0,0">
                        <Button Content="Import" Command="{Binding Path=ImportWorkItemQueriesCommand}" />
                    </WrapPanel>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>
